[Fusion] Add support for provides#9588
Merged
michaelstaib merged 4 commits intomainfrom Apr 23, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds planner + execution metadata support for @provides in Fusion so the gateway can avoid unnecessary downstream fetches when a subgraph resolver already supplies otherwise-external fields.
Changes:
- Extend source field metadata to carry
IsExternal+Providesselection sets and thread this through schema completion. - Update selection-set partitioning to respect
@providesscopes (including interface inline-fragment provides) and treat external-only fields as non-resolvable unless covered by provides. - Add planner-level and ASP.NET Core integration tests + snapshots for provides scenarios (partial coverage, interface, deeply nested, requires interaction, shareable override, etc.).
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Fusion/src/Fusion.Execution/Planning/Partitioners/SelectionSetPartitioner.cs | Core planner change: interpret provides scopes (incl. inline fragments), treat external fields correctly, and propagate provides to nested selections. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/Metadata/SourceOutputField.cs | Adds IsExternal and Provides metadata to per-subgraph field representation. |
| src/HotChocolate/Fusion/src/Fusion.Execution.Types/Completion/CompositeSchemaBuilder.cs | Populates the new SourceOutputField metadata from parsed directives during schema build. |
| src/HotChocolate/Core/src/Types/Types/Composite/Types/FieldSelectionSetType.cs | Improves selection-set parsing helper to accept either wrapped or unwrapped strings. |
| src/HotChocolate/Core/src/Types/Types/Composite/Directives/Provides.cs | Uses the shared selection-set parsing helper. |
| src/HotChocolate/Core/src/Types/Types/Composite/Directives/EntityKey.cs | Uses the shared selection-set parsing helper. |
| src/HotChocolate/Core/src/Types/Types/Composite/Directives/EntityKeyDescriptorExtensions.cs | Uses the shared selection-set parsing helper. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/ProvidesPlannerTests.cs | Adds planner-level tests for provides semantics. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/snapshots/ProvidesPlannerTests.*.yaml | Snapshot baselines for planner provides scenarios. |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/ProvidesTests.cs | Adds integration tests verifying runtime behavior and subgraph interaction patterns. |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/snapshots/ProvidesTests.*.yaml | Snapshot baselines for integration provides scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.